package com.x.part3_代码块;

/**
 * ClassName: User1
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2024.03.03 1:36
 */
public class User1 {
    private String userName;
    private String passWord;

    private long registrationTime;

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public long getRegistrationTime() {
        return registrationTime;
    }

    {
        System.out.println("新用户注册");
        registrationTime=System.currentTimeMillis();//获取当前时间
    }

    public User1(){
        //System.out.println("新用户注册");
        //registrationTime=System.currentTimeMillis();//获取当前时间
        userName = System.currentTimeMillis()+"";
        passWord="123456";
    }
    public User1(String userName,String passWord){
        //System.out.println("新用户注册");
        //registrationTime=System.currentTimeMillis();//获取当前时间
        this.userName=userName;
        this.passWord=passWord;

    }


    //类似toString()方法
    public String getInfo() {
        return
                "用户名：'" + userName + '\'' +
                        ", 密码：'" + passWord + '\'' +
                        ", 注册时间：" + registrationTime;
    }
}
